(function ($, _, lmViewer) {

  var srv = lmViewer.srv;

  /*
   * version:1.0
   * date:2016-7-29
   * auth:wu.yu
   * desc:获取配置信息
   * usage:
   *
   * */

  srv.getAskByImageId = function (data, success, fail) {
    var _obj = {
      path: "ask/getAskByImageId",
      data: data
    }
    lm.ajax.post(_obj)
  }

  srv.service_ImageViewer_getConfig = function (success, fail) {

    var _obj = {
      path: "service/ImageViewer/getConfig"
    }
    lm.ajax.get(_obj, success, fail);
  };

  srv.service_series_getseries = function (data, success, fail) {

    var _obj = {
      path: "service/series/getseries",
      data: {
        patientid: data.patientid,
        studyid: data.studyid,
        dcmURL: data.dcmURL,

      }
    }
    lm.ajax.get(_obj, success, fail);
  };

  srv.GetFileMetaInfoServlet = function (data, success, fail) {
    var _obj = {
      path: "GetFileMetaInfoServlet",
      data: {
        studyIuid: data.studyIuid
      }
    }
    lm.ajax.post(_obj, success, fail);
  };

  srv.service_instances_getinstances = function (data, success, fail) {
    var _obj = {
      path: "service/instances/getinstances",
      data: {
        hostURL: data.hostURL,
        patientid: data.patientid,
        studyid: data.studyid,
        seriesid: data.seriesid,
        dcmURL: data.dcmURL,
        serverURL: data.serverURL
      }
    }
    lm.ajax.get(_obj, success, fail);
  };

  srv.service_image_imageId = function (data, success, fail) {
    var _obj = {
      path: "service/image/" + data.imageId
    }
    lm.ajax.get(_obj, success, fail);
  };


  srv.service_ask_imagelist = function (data, success, fail) {
    var _obj = {
      path: "service/ask/imagelist",
      data: {
        askid: data.askid,
        curpage: data.curpage,
        pagesize: data.pagesize
      }
    }
    lm.ajax.get(_obj, success, fail);
  };

  srv.service_share2image_shareid = function (data, success, fail) {
    var _obj = {
      path: "service/share2image/" + data.shareid,
      data: {
        shareid: data.shareid
      }
    }
    lm.ajax.get(_obj, success, fail);
  };

  srv.service_eformimage_eformid = function (data, success, fail) {
    var _obj = {
      path: "service/eformimage/" + data.eformid,
      data: {
        eformid: data.eformid
      }
    }
  };

  // //获取影像列表
  // srv.getImageList = function (data, success, fail) {
  //   var _obj = {
  //     path: "/service/image/list",
  //     data: data
  //   }
  //   lm.ajax.post(_obj, success, fail);
  // };


})(jQuery, _, lmViewer);
/*

var fail = function () {
  console.log("fail method is running...");
};
//
lmViewer.srv.service_ImageViewer_getConfig(function (data) {
  console.log("[getConfig|success]---" + JSON.stringify(data, null, 4));
}, fail());

var GetFileMetaInfoServlet_data = {
  studyIuid: "1.2.156.112572.18161010101313.5319160852.1082"
};
lmViewer.srv.GetFileMetaInfoServlet(GetFileMetaInfoServlet_data, function (data) {
  console.log("[GetFileMetaInfoServlet_data|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_series_getseries_data = {
  patientid: "10007",
  studyid: "1.2.156.112572.18161010101313.5319160852.1082",
  dcmURL: "DICOM://DCM4CHEE:OVIYAM2@127.0.0.1:11112"
};
lmViewer.srv.service_series_getseries(service_series_getseries_data, function (data) {
  console.log("[service_series_getseries|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_instances_getinstances_data = {
  hostURL: 'http://123.56.201.253:8888',
  patientid: 'LOCAL_37',
  studyid: '1.2.156.112572.18161010101313.4715113518.147',
  seriesid: '1.2.156.112572.18161010101313.4715113600.1',
  dcmURL: 'DICOM://DCM4CHEE:OVIYAM2@127.0.0.1:11112',
  serverURL: 'http://localhost:8080'
};
lmViewer.srv.service_instances_getinstances(service_instances_getinstances_data, function (data) {
  console.log("[service_instances_getinstances|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_image_imageId_data = {
  imageId: 69
};
lmViewer.srv.service_image_imageId(service_image_imageId_data, function (data) {
  console.log("[service_image_imageId|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_ask_imagelist_data = {
  askid: 928,
  curpage: 1,
  pagesize: 1000
};
lmViewer.srv.service_ask_imagelist(service_ask_imagelist_data, function (data) {
  console.log("[service_ask_imagelist|success]---" + JSON.stringify(data, null, 4));
}, fail());

var service_share2image_shareid_data = {
  shareid: '105'
};
lmViewer.srv.service_share2image_shareid(service_share2image_shareid_data, function (data) {
  console.log("[service_share2image_shareid|success]---" + JSON.stringify(data, null, 4));
}, fail());

lmViewer.srv.service_ImageViewer_getConfig(function (data) {


  var response = {
    "result": 0,
    "message": "DICOM://DCM4CHEE:OVIYAM2@127.0.0.1:11112;http://localhost:8080"
  }
  var str = "[getConfig|success]---" + JSON.stringify(data, null, 4)
  console.log(str);


  var userName = {
    user: "wuyu",
    password: "1234333333356"
  }
  lm.msgShow.logObj("Viewer.src|msg[zh_cn]", lm.msg["zh_cn"].interface.default.error.longMsg, "prod");

}, fail());


var GetFileMetaInfoServlet_data = {
  studyIuid: "1.2.156.112572.18161010101313.5319160852.1082"
};
lmViewer.srv.GetFileMetaInfoServlet(GetFileMetaInfoServlet_data, function (data) {

  var response = {
    "result": 0,
    "message": [
      {
        "imageOrientation": "1.000000\\0.000000\\0.000000\\0.000000\\0.995346\\-0.096368",
        "imagePosition": "-123.299492\\-125.498047\\-23.058453",
        "columns": "256",
        "pixelSpacing": "0.9411765\\0.9411765",
        "sopIuid": "1.2.156.112572.18161010101313.5319161552.3.1",
        "frameOfReferenceUID": "1.2.156.112572.18161010101313.1082.5319160852",
        "rows": "256",
        "seriesIuid": "1.2.156.112572.18161010101313.5319161352.3"
      }
    ]
  }
  console.log("[GetFileMetaInfoServlet_data|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_series_getseries_data = {
  patientid: "10007",
  studyid: "1.2.156.112572.18161010101313.5319160852.1082",
  dcmURL: "DICOM://DCM4CHEE:OVIYAM2@127.0.0.1:11112"
};
lmViewer.srv.service_series_getseries(service_series_getseries_data, function (data) {
  var response = {
    "result": 0,
    "message": [
      {
        "numberOfInstances": "15",
        "modality": "MR",
        "seriesDescription": "3-Plane Loc",
        "seriesTime": "161012",
        "seriesDate": "20140725",
        "bodyPartExamined": "HEAD",
        "seriesCount": "",
        "seriesIUID": "1.2.156.112572.18161010101313.5319161012.1",
        "seriesNumber": "1"
      },
      {
        "numberOfInstances": "15",
        "modality": "MR",
        "seriesDescription": "Axi TR-FSE2D T2W",
        "seriesTime": "161352",
        "seriesDate": "20140725",
        "bodyPartExamined": "HEAD",
        "seriesCount": "",
        "seriesIUID": "1.2.156.112572.18161010101313.5319161352.3",
        "seriesNumber": "3"
      }
    ]
  }
  console.log("[service_series_getseries|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_instances_getinstances_data = {
  hostURL: 'http://123.56.201.253:8888',
  patientid: 'LOCAL_37',
  studyid: '1.2.156.112572.18161010101313.4715113518.147',
  seriesid: '1.2.156.112572.18161010101313.4715113600.1',
  dcmURL: 'DICOM://DCM4CHEE:OVIYAM2@127.0.0.1:11112',
  serverURL: 'http://localhost:8080'
};
lmViewer.srv.service_instances_getinstances(service_instances_getinstances_data, function (data) {
  var response = {
    "result": 0,
    "message": [
      {
        "sliceThickness": "10.000000 ",
        "imgOrient": "1.000000\\0.000000\\0.000000\\0.000000\\1.000000\\0.000000 ",
        "imgPosition": "-190.000000\\-190.000000\\-30.000000",
        "numberOfFrames": "1",
        "sopClassUID": "1.2.840.10008.5.1.4.1.1.4",
        "sopIUID": "1.2.156.112572.18161010101313.4715113747.1.1",
        "frameOfReferenceUID": "1.2.156.112572.18161010101313.147.4715113518",
        "instanceNumber": "1",
        "sliceLocation": "-30.000000"
      }
    ]
  };
  console.log("[service_instances_getinstances|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_image_imageId_data = {
  imageId: 69
};
lmViewer.srv.service_image_imageId(service_image_imageId_data, function (data) {
  var response = {
    "result": 0,
    "message": {
      "birthday": "19620718",
      "imageid": 69,
      "modality": "MR",
      "thumb": "704505b056444444b664cf90bab309ca.jpg",
      "studydate": "20160718",
      "userid": 0,
      "sortord": "",
      "uploadendtime": "",
      "studyendtime": "",
      "uploadstarttime": "",
      "pagesize": 0,
      "serverip": "127.0.0.1",
      "html": "",
      "studyid": "1.2.156.112572.18161010101313.6043155854.235",
      "term": "",
      "uploaduser": 6,
      "uploadtime": "2016-07-21 09:58:13",
      "institutionname": "XMDT MRI Lab",
      "truename": "",
      "imagetype": "dicom",
      "filmcount": 75,
      "patientid": "LOCAL_109",
      "uploaddate": "20160721",
      "sex": 1,
      "sopinstanceuid": "1.2.156.112572.18161010101313.6043160057.1.1",
      "studystarttime": "",
      "uploadtype": 2,
      "havereport": 0,
      "haveask": 0,
      "seriesid": "1.2.156.112572.18161010101313.6043155922.1",
      "patientname": "zhao wei ying",
      "studydescription": "www.LinkingMed.com636046918914794538",
      "pagestart": 0,
      "updatetime": "2016-07-22 11:26:00",
      "checkcode": "7TG7",
      "defaultimage": "0",
      "age": 0
    }
  };
  console.log("[service_image_imageId|success]---" + JSON.stringify(data, null, 4));
}, fail());


var service_ask_imagelist_data = {
  askid: 928,
  curpage: 1,
  pagesize: 1000
};
lmViewer.srv.service_ask_imagelist(service_ask_imagelist_data, function (data) {
  var response = {
    "result": 0,
    "message": []
  }
  console.log("[service_ask_imagelist|success]---" + JSON.stringify(data, null, 4));
}, fail());

var service_share2image_shareid_data = {
  shareid: '105'
};
lmViewer.srv.service_share2image_shareid(service_share2image_shareid_data, function (data) {
  var response = {
    "result": 0,
    "message": {
      "imageid": 27,
      "thumb": "",
      "endtime": "2016-08-01",
      "privacy": 0,
      "shareuser": 16,
      "shareid": 105,
      "targetuser": "",
      "sharetime": "2016-08-01 14:22:11",
      "targetusername": "",
      "url": "yMfaim",
      "sortord": "",
      "sharename": "分享8-1-1",
      "caseid": 108,
      "qrfile": "1626411077649871.png",
      "pagesize": 0,
      "anonymous": 0,
      "term": "",
      "pagestart": 0,
      "updatetime": "",
      "checkcode": "1234"
    }
  };
  console.log("[service_share2image_shareid|success]---" + JSON.stringify(data, null, 4));
}, fail());

var service_eformimage_eformid_data = {
  eformid: '9'
};
lmViewer.srv.service_eformimage_eformid(service_eformimage_eformid_data, function (data) {
  var response = {
    "result": 0,
    "message": {
      "eformid": 9,
      "imageid": 9,
      "qrfile": "1626207374370207.png",
      "eformtime": "2016-08-01 14:18:48",
      "eformuser": 0,
      "url": "BjyEnu"
    }
  }
  console.log("[service_eformimage_eformid|success]---" + JSON.stringify(data, null, 4));
}, fail());



*/
